#!/bin/bash
echo "Step-by-step compilation..."
echo

WXWIN="/d/vc/wxWidgets-3.2.7"

echo "Step 1: Testing basic compilation..."
g++ -std=c++11 -O2 -Wall -Wextra \
    -I$WXWIN/include -I$WXWIN/include/msvc \
    -D__WXMSW__ -D_UNICODE -DUNICODE \
    src/simple_test.cpp \
    -L$WXWIN/lib/gcc_x64_dll \
    -lwxmsw32u_core -lwxbase32u \
    -lkernel32 -luser32 -lgdi32 \
    -o simple_test.exe

if [[ $? -eq 0 ]]; then
    echo "✅ Step 1: Basic compilation successful!"
    ./simple_test.exe --test
else
    echo "❌ Step 1: Basic compilation failed"
    exit 1
fi

echo
echo "Step 2: Testing interactive version..."
g++ -std=c++11 -O2 -Wall -Wextra \
    -I$WXWIN/include -I$WXWIN/include/msvc \
    -D__WXMSW__ -D_UNICODE -DUNICODE \
    src/cbp2make_ai_simple.cpp \
    -L$WXWIN/lib/gcc_x64_dll \
    -lwxmsw32u_core -lwxbase32u \
    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 \
    -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid \
    -lcomctl32 -lrpcrt4 -loleacc -luxtheme \
    -o cbp2make_ai_simple.exe

if [[ $? -eq 0 ]]; then
    echo "✅ Step 2: Interactive version successful!"
    echo "Testing basic functionality..."
    ./cbp2make_ai_simple.exe --ai-status
else
    echo "❌ Step 2: Interactive version failed"
    exit 1
fi

echo
echo "🎉 All compilation steps completed successfully!"
